US Gas and Oil Fields
Data Import
import pandas as pd
import matplotlib.pyplot as plt
import geopandas as gpd
import folium
import contextily as cx
import rtree
from zlib import crc32
import hashlib
from shapely.geometry import Point, LineString, Polygon/Users/jnapolitano/venvs/finance/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.10.2-CAPI-1.16.0) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.
warnings.warn(Oil and Natural Gas Field Data
## Importing our DataFrames
gisfilepath = "/Users/jnapolitano/Projects/data/energy/Oil_and_Natural_Gas_Fields.geojson"
fields_df = gpd.read_file(gisfilepath)
na = fields_df.PR_OIL.min()
fields_df.replace(na, 0 , inplace=True)
fields_df = fields_df.to_crs(epsg=3857)
fields_df.describe()| OBJECTID | PR_OIL | PR_GAS | SHAPE_Length | SHAPE_Area | |
|---|---|---|---|---|---|
| count | 224.000000 | 224.000000 | 224.000000 | 224.000000 | 224.000000 |
| mean | 112.500000 | 1530.496585 | 87.685987 | 16.473665 | 10.386605 |
| std | 64.807407 | 17219.764834 | 644.145040 | 43.284473 | 45.170003 |
| min | 1.000000 | 0.000000 | 0.000000 | 0.100238 | 0.000594 |
| 25% | 56.750000 | 0.000000 | 0.000000 | 2.511389 | 0.221885 |
| 50% | 112.500000 | 0.000000 | 0.000000 | 6.563044 | 1.225873 |
| 75% | 168.250000 | 0.000000 | 0.000000 | 14.317886 | 5.378536 |
| max | 224.000000 | 238050.000000 | 8446.000000 | 485.692251 | 448.052251 |
.. index::
single: Oil/Gas Fields Map by Commodity
Oil Gas Field Map by Commodity
fields_map =fields_df.explore(
column="COMMODITY", # make choropleth based on "PORT_NAME" column
popup=False, # show all values in popup (on click)
tiles="Stamen Terrain", # use "CartoDB positron" tiles
cmap='Reds', # use "Set1" matplotlib colormap
#style_kwds=dict(color="black"),
marker_kwds= dict(radius=6),
tooltip=['NAICS_DESC','REGION', 'COMMODITY' ],
legend =True, # use black outline)
categorical=True,
)
fields_mapMake this Notebook Trusted to load map: File -> Trust Notebook
